<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>mpe debug 页面</title>
</head>
<body>

<h1>此页面仅用来调试,每次默认调试时间为一小时</h1>
<script src="/res/js/framework/jquery.min.js"></script>
<script>
    /*!
     * 功能：Cookie操作
     * set参数：name,value必选的
     * options为{hours:null,path:null,domain:null,secure:false}
     * get(name)获取；
     * remove(name)移除
     * 2013-01-23
     */
    Cookie={
        set:function(name,value,options){
            var defaults={
                hours:24*30*12,		//几个钟后终止(默认一年)
                path:null,		//可访问cookie的目录
                domain:window.location.host.indexOf("dasu123.my")!=-1 ? "dasu123.my" : null, 	//可访问主机名
                secure:false 	//数据传输加密
            };
            var opts=$.extend(defaults ,options);
            var expires="";
            if(opts.hours != null){
                var date = new Date();
                var ms = opts.hours*3600*1000;
                date.setTime(date.getTime() + ms);
                expires= "; expires=" + date.toGMTString();
            }
            document.cookie = name + "=" + escape (value) + expires +
                    ((opts.path == null) ? "" : ("; path=" + opts.path)) +
                    ((opts.domain == null) ? "" : ("; domain=" + opts.domain)) +
                    ((opts.secure) ? "; secure" : "");
        },
        get:function(name){
            var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
            if(arr != null){
                return unescape(arr[2]);
            }
            return null;
        },
        remove:function(name, domain, path){
            domain = domain || window.location.host.indexOf("dasu123.my")!=-1 ? "dasu123.my" : null
            var expires = new Date();
            expires.setTime(expires.getTime() - 1);
            var cval=this.get(name);
            if(cval!=null){
                document.cookie= name + "="+cval+";expires="+expires.toGMTString() + "path="+ (path ? path :"/")+ "; " + (domain ? ("domain=" + domain + ";") : "");
            }
        }
    };

</script>
<script>
    var a="";
    var domain=null;
    if(window.location.host.indexOf("mpe.dasu123.com")!=-1){
        domain="mpe.dasu123.com";
    }
    if(a=="c"){
        Cookie.remove("debugFlag");
        alert("已退出JS调试模式了，谢谢！");
    }
    if(a==""){
        Cookie.set("debugFlag",true,{
            hours:4,
            path:"/",
            domain:domain
        });
        alert("你可以进入JS调试模式了，谢谢！");
    }
    setTimeout(function(){
        window.opener=null;
        window.open('','_self');
        window.close();
    },300);
</script>
</body>
</html>
